package torque.generated;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.map.TableMap;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;





/**
 * objet Table
 *
 * This class was autogenerated by Torque on:
 *
 * [Wed Mar 21 10:21:18 CET 2012]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Objet
 */
public abstract class BaseObjet extends BaseObject
{
    /** Serial version */
    private static final long serialVersionUID = 1332321678105L;

    /** The Peer class */
    private static final ObjetPeer peer =
        new ObjetPeer();


    /** The value for the nomo field */
    private String nomo;

    /** The value for the actif field */
    private boolean actif;


    /**
     * Get the Nomo
     *
     * @return String
     */
    public String getNomo()
    {
        return nomo;
    }


    /**
     * Set the value of Nomo
     *
     * @param v new value
     */
    public void setNomo(String v) throws TorqueException
    {

        if (!ObjectUtils.equals(this.nomo, v))
        {
            this.nomo = v;
            setModified(true);
        }



        // update associated Objetinventaire
        if (collObjetinventaires != null)
        {
            for (int i = 0; i < collObjetinventaires.size(); i++)
            {
                ((Objetinventaire) collObjetinventaires.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Caracobjet
        if (collCaracobjets != null)
        {
            for (int i = 0; i < collCaracobjets.size(); i++)
            {
                ((Caracobjet) collCaracobjets.get(i))
                        .setNomobjet(v);
            }
        }

        // update associated Positionobjet
        if (collPositionobjets != null)
        {
            for (int i = 0; i < collPositionobjets.size(); i++)
            {
                ((Positionobjet) collPositionobjets.get(i))
                        .setNomobjet(v);
            }
        }
    }

    /**
     * Get the Actif
     *
     * @return boolean
     */
    public boolean getActif()
    {
        return actif;
    }


    /**
     * Set the value of Actif
     *
     * @param v new value
     */
    public void setActif(boolean v) 
    {

        if (this.actif != v)
        {
            this.actif = v;
            setModified(true);
        }


    }

       


    /**
     * Collection to store aggregation of collObjetinventaires
     */
    protected List collObjetinventaires;

    /**
     * Temporary storage of collObjetinventaires to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initObjetinventaires()
    {
        if (collObjetinventaires == null)
        {
            collObjetinventaires = new ArrayList();
        }
    }


    /**
     * Method called to associate a Objetinventaire object to this object
     * through the Objetinventaire foreign key attribute
     *
     * @param l Objetinventaire
     * @throws TorqueException
     */
    public void addObjetinventaire(Objetinventaire l) throws TorqueException
    {
        getObjetinventaires().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Objetinventaire object to this object
     * through the Objetinventaire foreign key attribute using connection.
     *
     * @param l Objetinventaire
     * @throws TorqueException
     */
    public void addObjetinventaire(Objetinventaire l, Connection con) throws TorqueException
    {
        getObjetinventaires(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collObjetinventaires
     */
    private Criteria lastObjetinventairesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetinventaires(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getObjetinventaires()
        throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            collObjetinventaires = getObjetinventaires(new Criteria(10));
        }
        return collObjetinventaires;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetinventaires from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getObjetinventaires(Criteria criteria) throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            if (isNew())
            {
               collObjetinventaires = new ArrayList();
            }
            else
            {
                criteria.add(ObjetinventairePeer.NOMOBJET, getNomo() );
                collObjetinventaires = ObjetinventairePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
                if (!lastObjetinventairesCriteria.equals(criteria))
                {
                    collObjetinventaires = ObjetinventairePeer.doSelect(criteria);
                }
            }
        }
        lastObjetinventairesCriteria = criteria;

        return collObjetinventaires;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetinventaires(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetinventaires(Connection con) throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            collObjetinventaires = getObjetinventaires(new Criteria(10), con);
        }
        return collObjetinventaires;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetinventaires from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetinventaires(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            if (isNew())
            {
               collObjetinventaires = new ArrayList();
            }
            else
            {
                 criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
                 collObjetinventaires = ObjetinventairePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
                 if (!lastObjetinventairesCriteria.equals(criteria))
                 {
                     collObjetinventaires = ObjetinventairePeer.doSelect(criteria, con);
                 }
             }
         }
         lastObjetinventairesCriteria = criteria;

         return collObjetinventaires;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetinventaires from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetinventairesJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            if (isNew())
            {
               collObjetinventaires = new ArrayList();
            }
            else
            {
                criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
                collObjetinventaires = ObjetinventairePeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
            if (!lastObjetinventairesCriteria.equals(criteria))
            {
                collObjetinventaires = ObjetinventairePeer.doSelectJoinObjet(criteria);
            }
        }
        lastObjetinventairesCriteria = criteria;

        return collObjetinventaires;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetinventaires from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetinventairesJoinInventaire(Criteria criteria)
        throws TorqueException
    {
        if (collObjetinventaires == null)
        {
            if (isNew())
            {
               collObjetinventaires = new ArrayList();
            }
            else
            {
                criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
                collObjetinventaires = ObjetinventairePeer.doSelectJoinInventaire(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetinventairePeer.NOMOBJET, getNomo());
            if (!lastObjetinventairesCriteria.equals(criteria))
            {
                collObjetinventaires = ObjetinventairePeer.doSelectJoinInventaire(criteria);
            }
        }
        lastObjetinventairesCriteria = criteria;

        return collObjetinventaires;
    }





    /**
     * Collection to store aggregation of collCaracobjets
     */
    protected List collCaracobjets;

    /**
     * Temporary storage of collCaracobjets to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCaracobjets()
    {
        if (collCaracobjets == null)
        {
            collCaracobjets = new ArrayList();
        }
    }


    /**
     * Method called to associate a Caracobjet object to this object
     * through the Caracobjet foreign key attribute
     *
     * @param l Caracobjet
     * @throws TorqueException
     */
    public void addCaracobjet(Caracobjet l) throws TorqueException
    {
        getCaracobjets().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Caracobjet object to this object
     * through the Caracobjet foreign key attribute using connection.
     *
     * @param l Caracobjet
     * @throws TorqueException
     */
    public void addCaracobjet(Caracobjet l, Connection con) throws TorqueException
    {
        getCaracobjets(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collCaracobjets
     */
    private Criteria lastCaracobjetsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCaracobjets(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getCaracobjets()
        throws TorqueException
    {
        if (collCaracobjets == null)
        {
            collCaracobjets = getCaracobjets(new Criteria(10));
        }
        return collCaracobjets;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Caracobjets from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCaracobjets(Criteria criteria) throws TorqueException
    {
        if (collCaracobjets == null)
        {
            if (isNew())
            {
               collCaracobjets = new ArrayList();
            }
            else
            {
                criteria.add(CaracobjetPeer.NOMOBJET, getNomo() );
                collCaracobjets = CaracobjetPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
                if (!lastCaracobjetsCriteria.equals(criteria))
                {
                    collCaracobjets = CaracobjetPeer.doSelect(criteria);
                }
            }
        }
        lastCaracobjetsCriteria = criteria;

        return collCaracobjets;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCaracobjets(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCaracobjets(Connection con) throws TorqueException
    {
        if (collCaracobjets == null)
        {
            collCaracobjets = getCaracobjets(new Criteria(10), con);
        }
        return collCaracobjets;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Caracobjets from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCaracobjets(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCaracobjets == null)
        {
            if (isNew())
            {
               collCaracobjets = new ArrayList();
            }
            else
            {
                 criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
                 collCaracobjets = CaracobjetPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
                 if (!lastCaracobjetsCriteria.equals(criteria))
                 {
                     collCaracobjets = CaracobjetPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCaracobjetsCriteria = criteria;

         return collCaracobjets;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Caracobjets from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getCaracobjetsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collCaracobjets == null)
        {
            if (isNew())
            {
               collCaracobjets = new ArrayList();
            }
            else
            {
                criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
                collCaracobjets = CaracobjetPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
            if (!lastCaracobjetsCriteria.equals(criteria))
            {
                collCaracobjets = CaracobjetPeer.doSelectJoinObjet(criteria);
            }
        }
        lastCaracobjetsCriteria = criteria;

        return collCaracobjets;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Caracobjets from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getCaracobjetsJoinCaracteristique(Criteria criteria)
        throws TorqueException
    {
        if (collCaracobjets == null)
        {
            if (isNew())
            {
               collCaracobjets = new ArrayList();
            }
            else
            {
                criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
                collCaracobjets = CaracobjetPeer.doSelectJoinCaracteristique(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CaracobjetPeer.NOMOBJET, getNomo());
            if (!lastCaracobjetsCriteria.equals(criteria))
            {
                collCaracobjets = CaracobjetPeer.doSelectJoinCaracteristique(criteria);
            }
        }
        lastCaracobjetsCriteria = criteria;

        return collCaracobjets;
    }





    /**
     * Collection to store aggregation of collPositionobjets
     */
    protected List collPositionobjets;

    /**
     * Temporary storage of collPositionobjets to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initPositionobjets()
    {
        if (collPositionobjets == null)
        {
            collPositionobjets = new ArrayList();
        }
    }


    /**
     * Method called to associate a Positionobjet object to this object
     * through the Positionobjet foreign key attribute
     *
     * @param l Positionobjet
     * @throws TorqueException
     */
    public void addPositionobjet(Positionobjet l) throws TorqueException
    {
        getPositionobjets().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Positionobjet object to this object
     * through the Positionobjet foreign key attribute using connection.
     *
     * @param l Positionobjet
     * @throws TorqueException
     */
    public void addPositionobjet(Positionobjet l, Connection con) throws TorqueException
    {
        getPositionobjets(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collPositionobjets
     */
    private Criteria lastPositionobjetsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPositionobjets(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getPositionobjets()
        throws TorqueException
    {
        if (collPositionobjets == null)
        {
            collPositionobjets = getPositionobjets(new Criteria(10));
        }
        return collPositionobjets;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Positionobjets from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getPositionobjets(Criteria criteria) throws TorqueException
    {
        if (collPositionobjets == null)
        {
            if (isNew())
            {
               collPositionobjets = new ArrayList();
            }
            else
            {
                criteria.add(PositionobjetPeer.NOMOBJET, getNomo() );
                collPositionobjets = PositionobjetPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
                if (!lastPositionobjetsCriteria.equals(criteria))
                {
                    collPositionobjets = PositionobjetPeer.doSelect(criteria);
                }
            }
        }
        lastPositionobjetsCriteria = criteria;

        return collPositionobjets;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPositionobjets(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPositionobjets(Connection con) throws TorqueException
    {
        if (collPositionobjets == null)
        {
            collPositionobjets = getPositionobjets(new Criteria(10), con);
        }
        return collPositionobjets;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Positionobjets from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPositionobjets(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collPositionobjets == null)
        {
            if (isNew())
            {
               collPositionobjets = new ArrayList();
            }
            else
            {
                 criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
                 collPositionobjets = PositionobjetPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
                 if (!lastPositionobjetsCriteria.equals(criteria))
                 {
                     collPositionobjets = PositionobjetPeer.doSelect(criteria, con);
                 }
             }
         }
         lastPositionobjetsCriteria = criteria;

         return collPositionobjets;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Positionobjets from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getPositionobjetsJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collPositionobjets == null)
        {
            if (isNew())
            {
               collPositionobjets = new ArrayList();
            }
            else
            {
                criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
                collPositionobjets = PositionobjetPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
            if (!lastPositionobjetsCriteria.equals(criteria))
            {
                collPositionobjets = PositionobjetPeer.doSelectJoinObjet(criteria);
            }
        }
        lastPositionobjetsCriteria = criteria;

        return collPositionobjets;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Positionobjets from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getPositionobjetsJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collPositionobjets == null)
        {
            if (isNew())
            {
               collPositionobjets = new ArrayList();
            }
            else
            {
                criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
                collPositionobjets = PositionobjetPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PositionobjetPeer.NOMOBJET, getNomo());
            if (!lastPositionobjetsCriteria.equals(criteria))
            {
                collPositionobjets = PositionobjetPeer.doSelectJoinPartie(criteria);
            }
        }
        lastPositionobjetsCriteria = criteria;

        return collPositionobjets;
    }



        
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
            fieldNames.add("Nomo");
            fieldNames.add("Actif");
            fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by field (Java) name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
        if (name.equals("Nomo"))
        {
            return getNomo();
        }
        if (name.equals("Actif"))
        {
            return new Boolean(getActif());
        }
        return null;
    }

    /**
     * Set a field in the object by field (Java) name.
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByName(String name, Object value )
        throws TorqueException, IllegalArgumentException
    {
        if (name.equals("Nomo"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setNomo((String) value);
            return true;
        }
        if (name.equals("Actif"))
        {
            if (value == null || ! (Boolean.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not a Boolean object.");
            }
            setActif(((Boolean)value).booleanValue());
            return true;
        }
        return false;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
        if (name.equals(ObjetPeer.NOMO))
        {
            return getNomo();
        }
        if (name.equals(ObjetPeer.ACTIF))
        {
            return new Boolean(getActif());
        }
        return null;
    }

    /**
     * Set field values by Peer Field Name
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPeerName(String name, Object value)
        throws TorqueException, IllegalArgumentException
    {
      if (ObjetPeer.NOMO.equals(name))
        {
            return setByName("Nomo", value);
        }
      if (ObjetPeer.ACTIF.equals(name))
        {
            return setByName("Actif", value);
        }
        return false;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
        if (pos == 0)
        {
            return getNomo();
        }
        if (pos == 1)
        {
            return new Boolean(getActif());
        }
        return null;
    }

    /**
     * Set field values by its position (zero based) in the XML schema.
     *
     * @param position The field position
     * @param value field value
     * @return True if value was set, false if not (invalid position / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPosition(int position, Object value)
        throws TorqueException, IllegalArgumentException
    {
    if (position == 0)
        {
            return setByName("Nomo", value);
        }
    if (position == 1)
        {
            return setByName("Actif", value);
        }
        return false;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
        save(ObjetPeer.DATABASE_NAME);
    }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
     *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
        try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
    }

    /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;



            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    ObjetPeer.doInsert((Objet) this, con);
                    setNew(false);
                }
                else
                {
                    ObjetPeer.doUpdate((Objet) this, con);
                }
            }


            if (collObjetinventaires != null)
            {
                for (int i = 0; i < collObjetinventaires.size(); i++)
                {
                    ((Objetinventaire) collObjetinventaires.get(i)).save(con);
                }
            }

            if (collCaracobjets != null)
            {
                for (int i = 0; i < collCaracobjets.size(); i++)
                {
                    ((Caracobjet) collCaracobjets.get(i)).save(con);
                }
            }

            if (collPositionobjets != null)
            {
                for (int i = 0; i < collPositionobjets.size(); i++)
                {
                    ((Positionobjet) collPositionobjets.get(i)).save(con);
                }
            }
            alreadyInSave = false;
        }
    }


    /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key nomo ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
        setNomo(key.toString());
    }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
        setNomo(key);
    }


    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
        return SimpleKey.keyFor(getNomo());
    }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     */
    public Objet copy() throws TorqueException
    {
        return copy(true);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     *
     * @param con the database connection to read associated objects.
     */
    public Objet copy(Connection con) throws TorqueException
    {
        return copy(true, con);
    }

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     */
    public Objet copy(boolean deepcopy) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     * @param con the database connection to read associated objects.
     */
    public Objet copy(boolean deepcopy, Connection con) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     */
    protected Objet copyInto(Objet copyObj) throws TorqueException
    {
        return copyInto(copyObj, true);
    }

  
    /**
     * Fills the copyObj with the contents of this object using connection.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, Connection con) throws TorqueException
    {
        return copyInto(copyObj, true, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy) throws TorqueException
    {
        copyObj.setNomo(nomo);
        copyObj.setActif(actif);

        copyObj.setNomo((String)null);

        if (deepcopy)
        {


        List vObjetinventaires = getObjetinventaires();
        if (vObjetinventaires != null)
        {
            for (int i = 0; i < vObjetinventaires.size(); i++)
            {
                Objetinventaire obj = (Objetinventaire) vObjetinventaires.get(i);
                copyObj.addObjetinventaire(obj.copy());
            }
        }
        else
        {
            copyObj.collObjetinventaires = null;
        }


        List vCaracobjets = getCaracobjets();
        if (vCaracobjets != null)
        {
            for (int i = 0; i < vCaracobjets.size(); i++)
            {
                Caracobjet obj = (Caracobjet) vCaracobjets.get(i);
                copyObj.addCaracobjet(obj.copy());
            }
        }
        else
        {
            copyObj.collCaracobjets = null;
        }


        List vPositionobjets = getPositionobjets();
        if (vPositionobjets != null)
        {
            for (int i = 0; i < vPositionobjets.size(); i++)
            {
                Positionobjet obj = (Positionobjet) vPositionobjets.get(i);
                copyObj.addPositionobjet(obj.copy());
            }
        }
        else
        {
            copyObj.collPositionobjets = null;
        }
        }
        return copyObj;
    }
        
    
    /**
     * Fills the copyObj with the contents of this object using connection.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy, Connection con) throws TorqueException
    {
        copyObj.setNomo(nomo);
        copyObj.setActif(actif);

        copyObj.setNomo((String)null);

        if (deepcopy)
        {


        List vObjetinventaires = getObjetinventaires(con);
        if (vObjetinventaires != null)
        {
            for (int i = 0; i < vObjetinventaires.size(); i++)
            {
                Objetinventaire obj = (Objetinventaire) vObjetinventaires.get(i);
                copyObj.addObjetinventaire(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collObjetinventaires = null;
        }


        List vCaracobjets = getCaracobjets(con);
        if (vCaracobjets != null)
        {
            for (int i = 0; i < vCaracobjets.size(); i++)
            {
                Caracobjet obj = (Caracobjet) vCaracobjets.get(i);
                copyObj.addCaracobjet(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collCaracobjets = null;
        }


        List vPositionobjets = getPositionobjets(con);
        if (vPositionobjets != null)
        {
            for (int i = 0; i < vPositionobjets.size(); i++)
            {
                Positionobjet obj = (Positionobjet) vPositionobjets.get(i);
                copyObj.addPositionobjet(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collPositionobjets = null;
        }
        }
        return copyObj;
    }
    
    

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public ObjetPeer getPeer()
    {
        return peer;
    }

    /**
     * Retrieves the TableMap object related to this Table data without
     * compiler warnings of using getPeer().getTableMap().
     *
     * @return The associated TableMap object.
     */
    public TableMap getTableMap() throws TorqueException
    {
        return ObjetPeer.getTableMap();
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Objet:\n");
        str.append("Nomo = ")
           .append(getNomo())
           .append("\n");
        str.append("Actif = ")
           .append(getActif())
           .append("\n");
        return(str.toString());
    }
}
